import request from '@/utils/request'

export function getOne(params) {
  return request({
    url: '/api/statistics',
    method: 'get',
    params
  })
}

export function getAll(params) {
  return request({
    url: '/api/statistics/raw',
    method: 'get',
    params
  })
}
export function getActions(params) {
  return request({
    url: '/api/statistics/actions',
    method: 'get',
    params
  })
}

export function getActionDays(serialno) {
  return request({
    url: '/api/statistics/actionDays',
    method: 'get',
    params: { serialno }
  })
}

export function getHistories(params) {
  return request({
    url: '/api/statistics/history',
    method: 'get',
    params
  })
}

export function getGcwdDatas(params) {
  return request({
    url: '/api/statistics/gcwd',
    method: 'get',
    params
  })
}

export function getIrrigationAmount(params) {
  return request({
    url: '/api/statistics/irrigation',
    method: 'get',
    params
  })
}

export function fetch(type) {
  return request({
    url: `/api/statistics/fetch/${type}`,
    method: 'get'
  })
}

export function save(type, data) {
  return request({
    url: `/api/statistics/save/${type}`,
    method: 'post',
    data
  })
}
